#include "unified_ai_client.h"
#include <curl/curl.h>
#include <iostream>

// WriteCallback 函数
static size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* response) {
    size_t totalSize = size * nmemb;
    response->append((char*)contents, totalSize);
    return totalSize;
}

UnifiedAIClient::UnifiedAIClient() : m_modelType(AI_DEEPSEEK), m_modelName("default") {}

UnifiedAIClient::~UnifiedAIClient() {}

bool UnifiedAIClient::SetModel(AIModelType type, const std::string& version_id) {
    m_modelType = type;
    m_modelName = version_id.empty() ? "default" : version_id;
    return true;
}

std::string UnifiedAIClient::ChatCompletion(const std::string& prompt) {
    return "AI Response: Model " + m_modelName + " received prompt: " + prompt.substr(0, 50) + "...";
}

std::string UnifiedAIClient::GetModelStatus() const {
    return "Model: " + m_modelName + " (Type: " + std::to_string(static_cast<int>(m_modelType)) + ")";
}

std::string UnifiedAIClient::MakeRequest(const std::string& prompt) {
    return "Mock AI Response for: " + prompt;
}
